//
//  YDYViewController.m
//  CCXYQroject0
//
//  Created by a on 16/10/25.
//  Copyright © 2016年 a. All rights reserved.
//

#import "YDYViewController.h"
#import "AppDelegate.h"

@interface YDYViewController ()<UIScrollViewDelegate>
@property(nonatomic,strong)UIScrollView *scrollview1;

@end

@implementation YDYViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.hidden = YES;
    [self addyindaoye];
}

- (void)addyindaoye
{
    self.scrollview1 = [[UIScrollView alloc] initWithFrame:CGRectMake(0, -STATUSBAR_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT + STATUSBAR_HEIGHT)];
    _scrollview1.delegate = self;
    _scrollview1.contentSize = CGSizeMake(SCREEN_WIDTH *5 , SCREEN_HEIGHT + 20);
    _scrollview1.contentOffset = CGPointMake(0, 0);
    _scrollview1.pagingEnabled = YES;
    _scrollview1.bounces = NO;
    _scrollview1.showsHorizontalScrollIndicator = NO;
    [self.view addSubview:_scrollview1];
    
    NSArray *imgAry = @[@"yi",@"er",@"san",@"si",@"wu"];
    for (int i = 0; i < imgAry.count; i++)
    {
        UIImageView *imageview = [ZCControl createImageViewWithFrame:CGRectMake(SCREEN_WIDTH*i, 0, SCREEN_WIDTH, SCREEN_HEIGHT+ STATUSBAR_HEIGHT) ImageName:imgAry[i]];
        imageview.contentMode = UIViewContentModeScaleAspectFill;
        imageview.layer.masksToBounds = YES;
        [_scrollview1 addSubview:imageview];
        if (i == imgAry.count-1)
        {
            UIView *view010 = [[UIView alloc] initWithFrame:CGRectMake(60, SCREEN_HEIGHT - 150-STATUSBAR_HEIGHT, SCREEN_WIDTH - 120, 150+STATUSBAR_HEIGHT)];
            view010.backgroundColor = [UIColor clearColor];
            [imageview addSubview:view010];
            
            UITapGestureRecognizer *tap010 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap010act:)];
            //    // 设置至少点击几次（连续）
            tap010.numberOfTapsRequired = 1;
            //    // 设置几个手指点击
            tap010.numberOfTouchesRequired = 1;
            //    // 视图 添加了 轻拍手势
            [view010 addGestureRecognizer:tap010];
        }
    }
   
    
//    UIButton *nextbtn = [ZCControl createButtonWithFrame:CGRectMake(100*displaywidth, SCREEN_HEIGHT+20-75*displayheight, SCREEN_WIDTH-200*displaywidth, 45*displayheight) ImageName:nil Target:self Action:@selector(nextbtn) Title:@"立即体验" Font:16.0];
//    nextbtn.layer.cornerRadius = 22.5*displayheight;
//    nextbtn.layer.masksToBounds = YES;
//    nextbtn.backgroundColor = RGB(37, 178, 36);
//    [nextbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    [imageview004 addSubview:nextbtn];
    
    
    
    
}
//- (void)nextbtn
//{
//    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isfirst"];
//    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
//    [delegate loadRootViewController];
//}
- (void)tap010act:(UITapGestureRecognizer *)tap010
{
    NSString *appVersion = [LTools cacheForKey:kAppVersion];
    [LTools storage:YES ForKey:appVersion];
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [delegate loadRootViewController];
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
